home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 33
/
Volume 33 - JOGO DISK .iso
/
Games
/
pin_ball_deluxe.swf
/
scripts
/
frame_4
/
DoAction_2.as
next >
Wrap
Text File
|
2007-01-15
|
5KB
|
163 lines
function distance(x0, y0)
{
var _loc2_ = (this.a * x0 + this.b * y0 + this.c) / this.module;
return _loc2_;
}
function distancePoint(point)
{
var _loc3_ = point._x;
var _loc2_ = point._y;
var _loc4_ = (this.a * _loc3_ + this.b * _loc2_ + this.c) / this.module;
return _loc4_;
}
function distancePointAbs(point)
{
var _loc3_ = point._x;
var _loc2_ = point._y;
var _loc4_ = (this.a * _loc3_ + this.b * _loc2_ + this.c) / this.module;
distanceAbs = Math.abs(_loc4_);
return distanceAbs;
}
function distanceTo(point)
{
var _loc2_ = (this.a * point.x + this.b * point.y + this.c) / this.module - point._width / 2;
return _loc2_;
}
function getIntersection(a, b, c)
{
var _loc2_ = new Object();
_loc2_.x0 = (- (this.c * b - c * this.b)) / (this.a * b - a * this.b);
_loc2_.y0 = (this.c * a - c * this.a) / (this.a * b - a * this.b);
return _loc2_;
}
function isPartSegment(x0, y0)
{
if(x0 < this.x1 && x0 < this.x2 || this.x1 < x0 && this.x2 < x0 || y0 < this.y1 && y0 < this.y2 || this.y1 < y0 && this.y2 < y0)
{
return false;
}
return true;
}
function isPossibleTarget(myBall)
{
if(!this.active)
{
return false;
}
var _loc3_ = this.getIntersection(myBall.a,myBall.b,myBall.c);
var _loc4_ = (this.a * myBall.x + this.b * myBall.y + this.c) / this.module;
this.cachedDistance = _loc4_ - myBall._width / 2;
if(!this.isPartSegment(_loc3_.x0,_loc3_.y0))
{
if(_loc4_ >= 0 && this.cachedDistance <= 0)
{
var _loc5_ = this.a * myBall.x - this.b * myBall.y - this.c;
var _loc6_ = this.b * myBall.y - this.a * myBall.x - this.c;
if(this.isPartSegment(_loc5_,_loc6_))
{
return true;
}
}
return false;
}
if((_loc3_.x0 >= myBall._x && myBall.limit_x >= _loc3_.x0 || myBall._x >= _loc3_.x0 && _loc3_.x0 >= myBall.limit_x) && (_loc3_.y0 >= myBall._y && myBall.limit_y >= _loc3_.y0 || myBall._y >= _loc3_.y0 && _loc3_.y0 >= myBall.limit_y))
{
this.isCrossed = true;
return true;
}
this.isCrossed = false;
return true;
}
function Segment(a, b, c, x1, y1, x2, y2, point1, point2, clipObj)
{
this.a = a;
this.b = b;
this.c = c;
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.point1 = point1;
this.point2 = point2;
this.clipObj = clipObj;
this.module = Math.sqrt(this.a * this.a + this.b * this.b);
this.angle = Math.acos(this.b / this.module) / 3.141593 * 180;
if(this.y1 < this.y2)
{
this.angle = 180 - this.angle;
}
this.active = true;
this.distanceTo = distanceTo;
this.distancePoint = distancePoint;
this.distancePointAbs = distancePointAbs;
this.isPossibleTarget = isPossibleTarget;
this.getIntersection = getIntersection;
this.mark = mark;
this.isPartSegment = isPartSegment;
}
function mark(flag)
{
if(flag == 1)
{
this.point1.gotoAndStop(2);
this.point2.gotoAndStop(2);
}
else
{
this.point1.gotoAndStop(1);
this.point2.gotoAndStop(1);
}
}
function getSegment(point1, point2)
{
var _loc4_ = undefined;
if(point1._name == "b2" && point2._name == "b3")
{
_loc4_ = _root.electricR;
}
else if(point1._name == "a2" && point2._name == "a3")
{
_loc4_ = _root.electricL;
}
else if(point1._name == "d1b" && point2._name == "d1a")
{
_loc4_ = _root.holdRight_mc;
}
else if(point1._name == "d1a" && point2._name == "d1")
{
_loc4_ = _root.holdRight_mc;
}
else if(point1._name == "c7" && point2._name == "c8")
{
_loc4_ = _root.holdLeft_mc;
}
else if(point1._name == "c8" && point2._name == "c1")
{
_loc4_ = _root.holdLeft_mc;
}
else
{
_loc4_ = null;
}
var _loc8_ = point1._x;
var _loc6_ = point1._y;
var _loc7_ = point2._x;
var _loc5_ = point2._y;
var _loc11_ = _loc5_ - _loc6_;
var _loc10_ = _loc8_ - _loc7_;
var _loc9_ = (- _loc8_) * _loc5_ + _loc7_ * _loc6_;
return new Segment(_loc11_,_loc10_,_loc9_,_loc8_,_loc6_,_loc7_,_loc5_,point1,point2,_loc4_);
}
lives = 5;
score = 0;
countSecond = 0;
numeral = 0;
gamenumeral = 0;
bonusHit = 0;
allSegments = new Array();
allSegments1 = new Array();
allSegments2 = new Array();
allBalls = new Array();
allBalls1 = new Array();
allBalls2 = new Array();